package com.zrwl.poscloud.xo.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zrwl.poscloud.commons.vo.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * AdminVO
 *
 * @author: liusitong
 * @create: 2019-12-03-22:29
 */
@ApiModel(value = "管理员对象", description = "管理员对象Admin")
@Data
public class AdminVO extends BaseVO<AdminVO> {
    /**
     * 用户名
     */
    @ApiModelProperty(value = "用户名", name = "userName", example = "guest", required = true)
    private String userName;

    /**
     * 密码
     */
    private String passWord;

    /**
     * 昵称
     */
    @ApiModelProperty(value = "昵称", name = "nickName", example = "访客", required = false)
    private String nickName;

    /**
     * 性别(1:男2:女)
     */
    private String gender;

    /**
     * 个人头像
     */
    private String avatar;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 出生年月日
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date birthday;

    /**
     * 手机
     */
    private String mobile;

    /**
     * QQ号
     */
    private String qqNumber;

    /**
     * 微信号
     */
    private String weChat;

    /**
     * 职业
     */
    private String occupation;

    /**
     * 自我简介最多150字
     */
    private String summary;

    /**
     * 个人履历
     */
    private String personResume;

    /**
     * github地址
     */
    private String github;

    /**
     * gitee地址
     */
    private String gitee;

    /**
     * 角色Uid
     */
    private String roleUid;

    /**
     * 已用网盘容量
     */
    private Long storageSize;

    /**
     * 最大网盘容量
     */
    private Long maxStorageSize;

    private int ownerType;

    private String ownerUid;

    private String defaultUid;

    private String companyCode;
    private int companyType;
    private String comOrMerName;

    private List<AdminRoleVO> adminRoleVOList;

    private int comeFromWhere;

    private String houseUid;

    private String posUid;

    /**
     * 用户头像
     */
    private List<String> photoList;

    /**
     * 登录次数
     */
    private int loginCount;

    /**
     * 最后登录IP
     */
    private String lastLoginIp;
    /**
     * 最后登录时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date lastLoginTime;

    /**
     * 令牌UID【主要用于换取token令牌，防止token直接暴露到在线用户管理中】
     */
    private String tokenUid;

    /**
     * 验证码
     */
    private String validCode;
    private String oldMobileCode;
    private String oldValidCode;

    private String companyUid;
    private String merchantUid;
    private String companyName;
    private String merchantName;
    private String posPwd;
    private String cardPwd;
    private int startDisk;

    public boolean isCompany() {
        return this.ownerType == 2;
    }

    public boolean isMerchant() {
        return this.ownerType == 1;
    }

    public String getComOrMerName() {
        if (comOrMerName == null) {
            if (ownerType == 1)
                return merchantName;
            else
                return companyName;
        } else return comOrMerName;
    }

    private List<String> companyUidList;
}
